package com.example.grpc.proxy;

import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.socket.SocketChannel;
import io.netty.handler.codec.http2.Http2FrameCodecBuilder;

/**
 * @author honway.liu
 * @since 2021/12/29 11:51 PM
 */
public class GrpcServerInitializer extends ChannelInitializer<SocketChannel> {

    @Override
    protected void initChannel(SocketChannel ch) throws Exception {
        ChannelPipeline pipeline = ch.pipeline();
        pipeline.addLast(Http2FrameCodecBuilder.forServer().validateHeaders(false).autoAckSettingsFrame(true).build());
        pipeline.addLast(new CustHttp2ServerHandler());
    }
}
